-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added realignment to dlgp and pdm #428
base: release-1.0
Are you sure you want to change the base?
Conversation
use jdk 11 for running tests
rebase to different branch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for the PR. This is a very valuable addition.
I added a few minor comments, but find that it already looks good.
@@ -485,6 +505,12 @@ object DiscreteLowRankGaussianProcess { | |||
new DiscreteLowRankGaussianProcess[D, DDomain, Value](domain, meanVec, varianceVec, basisMat) | |||
} | |||
|
|||
def unapply[D: NDSpace, DDomain[D] <: DiscreteDomain[D], Value]( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we add an unapply method, we should also remove the private modifier from the corresponding fields, and maybe add an apply method. Like this it is a bit contradictory.
It was private so far to prevent access to it, but I don't have a strong opinion to keep it like this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i forgot to remove the unapply method. will be removed in the next version
* types the whole discrete low rank gp to make sure that it is applied to the appropriate models. The value type could | ||
* be left out if the user knows what to do. | ||
*/ | ||
trait RealignExtendedBasis[D: NDSpace, Value]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need the NDSpace context bound here? If not, it should be omitted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are right. good catch
It would be great if @Andreas-Forster or somebody else from Shapemeans could have a look at it regarding the user interface and practical usability. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you a lot for this addition. I believe this is something very useful.
I gave it a very short try with a random model lying around and my findings are the following:
- It feels natural to call the realign method from a PDM.
- The specified poins were stable when sampling.
- But, some of my expectations are not fulfilled. Mainly, I would have expected, that the same coefficients could produce more or less the same model instance. This seems not to be the case. The documentation does not give me a hint, nor where to look for a documentation of the implemented method.
- Could we also have a translation-only realign method? Or would that be meaningless?
I would love to see the documentation refer to a more in-depth explanation of the used algorithm before merging.
Thanks for taking a look:
I am not sure there is a suitable in-depth explanation of the used algorithm at the moment. |
Thanks, @Andreas-Forster for testing it. What do you think? |
I agree, keeping the basis non-orthonormal might confuse even more. And the projection matrix is not needed, as you mentioned, we have a project method. I think updating the documentation and maybe later, if available link some more verbose document might be valuable. |
…sis. slight refactor to RealignExtendedBasis
I did some further testing about the influence of a non orthonormal basis in scalismo. It seems the DiscreteLowRankGaussian can handle such a non diagonalized basis. There are also various other operations already in the class that modify an orthonormal basis and lead to a non orthonormal shape model. The only thing that i regularly do that shouldn't be done with a non orthonormal basis is directly accessing the variance field to check the overall variance of the model. without considering the basis this is incorrect for a non orthonormal model. All implementations i looked at are written to handle non orthonormal basis. So i can see that this comes down to preference. Closer equivalence between model spaces versus a more intuitive formulation of the resulting model space. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for adding this to the PR.
introduced
added functionality to realign a model, simulating a different pose of the original training data.
the function '.realign(ids)' can be accessed from DiscreteLowRankGaussian and PointDistributionModel.